// --------------------------------------------------------------------
//   name 	:  BBCode plugin
//   desc 	:  Displays the reply box in the messages
//			Displays the form already on the tribe forum threads to reply with
//   version 	: 
//   dev 	:  Maxime + Jelian
// --------------------------------------------------------------------
// DEPENDENCIES
// 
// --------------------------------------------------------------------
// CHANGE HISTORY
// 0.1 	Initial Release
// --------------------------------------------------------------------

plugins.mailForumReply = {
	'enhance_game_mail' : function() {
		if(location.href.match("screen=mail&mode=view") && getValuePlugin("ShowReplyBoxByDefault") == true){
			window.setTimeout(href="javascript:answer_show()");
		}
	},
	'enhance_forum_view_thread' : function() {
		if(location.href.indexOf("answer=true")!=-1 || location.href.indexOf("edit_post_id")!=-1) return;
		if(getValuePlugin("ShowTribePostReply").toString()=="false") return;
		var ThreadID = location.href.match(/thread_id=(\d+)/)[1];
		var ThreadPostHTML = '<table class="vis">'
			+'<tr><td>'
			+'<form action="forum.php?screen=view_thread&amp;action=new_post&amp;thread_id='+ThreadID+'" method="post">'
			+'Reply to tread:'
			+'<br /><textarea name="message" cols="80" rows="12"></textarea>'
			+'<br /><input type="submit" value="Send">'
			+'</form>'
			+'</td></tr>'
			+'</table>';
		$("table.main table:eq(2)").append(ThreadPostHTML);
	},
	'info' : {
		'mandatory' : false,
		'name' : "Quick Reply on Mail and Tribe forums.",
		'desc' : "Adds a quick reply text box so you can quickly reply to the opened message or forum thread",
		'version' : "v1.0",
		'dev' : "Maxime + JelianSD"
	},
	'variables' : {
		'tooltip':["Check the box to activate and uncheck to deactivate.","Check the box to activate and uncheck to deactivate."],
		'desc':["Display the post a reply box at the bottom of tribe forum threads.","Show or hide the Reply Box by default when opening a mail."],
		'ShowTribePostReply':true,
		'ShowReplyBoxByDefault':true
	}
}
